<template>
  <div class="wholesale-list block">
    <div class="header">
      <h2 class="title">手术跟台订单管理</h2>
      <tabs :tabs-arr="tabArr" @returnIndex="handletabs" />
      <el-form ref="queryForm" :inline="true" label-position="right" :model="tableQuery">
        <el-form-item label="订单编号">
          <el-input v-model="tableQuery.orderCode" type="text" placeholder="请输入订单编号" />
        </el-form-item>

        <el-form-item label="供应商" prop="supplierName">
          <el-input v-model="tableQuery.supplierName" type="text" placeholder="请输入供应商" />
        </el-form-item>

        <el-form-item label="生产厂家">
          <el-input v-model="tableQuery.originalFactoryName" type="text" placeholder="请输入生产厂家" />
        </el-form-item>

        <el-form-item label="产品线" style="margin-left:14px">
          <!-- <el-input v-model="tableQuery.productLineCode" type="text" placeholder="请输入产品线名称" /> -->
          <el-select
            v-model="tableQuery.productLineCode"
            filterable
            remote
            placeholder="请输入关键词"
            :remote-method="remoteMethod"
            :loading="loading"
          >
            <el-option
              v-for="item in options"
              :key="item.productLineCode"
              :label="item.productLineName"
              :value="item.productLineCode"
            />
          </el-select>
        </el-form-item>

        <el-form-item label="订单提交日期">
          <el-date-picker
            v-model="commitDate"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>

        <el-form-item class="form-button">
          <el-button type="primary" @click="queryFormQuery">查询</el-button>
          <el-button @click="queryFormReset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="hr"></div>
    <section class="el-container container-box is-vertical">
      <el-editable
        :row-class-name="tableRowClassName"
        :data="payload.content"
        height="200"
        v-loading="tableLoading"
        :columns="listColumns"
        :payload="payload"
        :needPagination="true"
        @reload="reloadProductData"
      >
        <template slot="default-orderStatus" slot-scope="scope">
          <el-button
            type="text"
            v-if="scope.row.orderStatus === 11"
            class="failColor"
            @click="showDialog(scope.row)"
          >
            {{
            scope.row.statusName
            }}
          </el-button>
          <span v-else>{{ scope.row.statusName }}</span>
        </template>
        <template slot="default-action" slot-scope="scope">
          <el-button v-if="scope.row.orderStatus === 1" type="text" @click="editGo(scope.row)">编辑</el-button>
          <el-button
            type="text"
            v-if="scope.row.orderStatus !== 1"
            @click="checkDetail(scope.row)"
          >查看</el-button>
          <el-button v-if="scope.row.orderStatus === 3" type="text" @click="toPay(scope.row)">去支付</el-button>
          <el-button
            v-if="scope.row.orderStatus === 5 || scope.row.orderStatus === 6"
            type="text"
            @click="takeDialog(scope.row)"
          >收货</el-button>
          <el-button
            v-if="scope.row.orderStatus === 2 || scope.row.orderStatus === 3 || scope.row.orderStatus === 4 "
            type="text"
            @click="cancel(scope.row)"
          >取消</el-button>
          <el-button
            v-if="scope.row.orderStatus === 9"
            type="text"
            @click="resubmit(scope.row)"
          >重新编辑</el-button>
          <el-button
            v-if="scope.row.orderStatus === 9 || scope.row.orderStatus === 1 "
            type="text"
            @click="delDialog(scope.row)"
          >删除</el-button>
        </template>
      </el-editable>
      <!-- 校验失败错误提醒 -->
      <el-dialog
        title="错误提醒"
        :modal="true"
        :fullscreen="fullscreen"
        custom-class="dialog-custom"
        :visible.sync="dialogVisible"
        width="50%"
      >
        <el-editable
          v-loading="errorTableLoading"
          :data="errorMsgData.content"
          :payload="errorMsgData"
          :columns="columns"
          :needPagination="true"
          @reload="reloadError"
        />
      </el-dialog>
      <!-- 删除 -->
      <el-dialog
        title="删除"
        :modal="true"
        :fullscreen="fullscreen"
        custom-class="dialog-custom"
        :visible.sync="delDialogVisible"
        width="50%"
      >
        <h2>您确定要执行删除操作吗?</h2>
        <div class="delBtn" @click="concelDel">
          <el-button>取消</el-button>
          <el-button type="primary" @click="delSure">确认</el-button>
        </div>
      </el-dialog>
    </section>
  </div>
</template>

<script src="./index.js"></script>

<style lang="less" src="./index.less" scoped></style>
